package com.process.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * package com.process.demo
 * description:
 *
 * @author tree
 * @date 2019-05-30 11:21
 */
public class RuntimeTest {
    public static void main(String[] args) throws Exception {
        ///Users/xingyun/IdeaProjects/PrintArgs/target
        //java -jar PrintArgs-1.0-SNAPSHOT.jar
        Process process = Runtime.getRuntime().exec("java -jar /Users/xingyun/IdeaProjects/PrintArgs/target/PrintArgs-1.0-SNAPSHOT.jar  ab c");
        InputStream is = process.getInputStream();
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        String line;
        while ((line = br.readLine() )!= null){
            System.out.println(line);
        }

        int exitCode = process.waitFor();
        System.out.println(exitCode);
    }
}
